<!--补件管理 -->
<template>
    <el-main>
        <el-main class="ep-body">


            <epl-top-bar :datas="{formData:form,panel:panel}" showPerson personType="PERSON_ALL_EXACT" psTagType="PERSON_INJURY_QUERY">
                <ep-button size="small" name="刷新"></ep-button>
            </epl-top-bar>
            <epl-userMessage dataType="person" idCount="4" >
            </epl-userMessage>

            <el-card class="ep-card">

                <el-form :model="form"  :rules="rules" >
                    <ep-title>页面还原</ep-title>
                    <ep-title>申请信息</ep-title>
                    <el-row :gutter="10">
                        <ep-input  label="人员id" name="aac001" :property="form.aac001"
                                   p="H"   :datas="{formData: form}" ></ep-input>
                        <ep-input  label="申报编号" name="bae506" :property="form.bae506"
                                   p="H"   :datas="{formData: form}" ></ep-input>
                        <ep-input  label="补件原因" name="blc545" :property="form.blc545"
                                   p="H"  :datas="{formData: form}" ></ep-input>
                        <ep-date  label="补正截至日期" name="blc544" :property="form.blc544"
                                  p="H"  :datas="{formData: form}"   ></ep-date>
                        <ep-date  label="鉴定状态" name="bae507" :property="form.bae507"
                                  p="H"  :datas="{formData: form}"   ></ep-date>
                    </el-row>


                    <!--不受理信息-->
                    <el-row :gutter="10">
                        <ep-input colspan="24" label="审查意见" name="blc500" :property="form.blc500"
                                  p="H"   :datas="{formData: form}" ></ep-input>
                    </el-row>
                    <el-row :gutter="10">
                        <ep-select colspan="24" label="不予受理依据" name="blc501" :property="form.blc501"
                                   p="H"  :datas="{formData: form}" codetype="BLC501"></ep-select>
                    </el-row>
                    <ep-title>材料列表</ep-title>
                    <ep-table :data="tableData"  border style="width: 100%;">


                        <ep-table-column editor="text" edited sortable header="材料id" name="baz515" ></ep-table-column>
                        <ep-table-column editor="text" edited sortable header="材料名称" name="bae546" ></ep-table-column>
                        <ep-table-column editor="select" edited sortable header="使用范围" name="bae547"  codetype="BAE547"></ep-table-column>
                        <ep-table-column editor="select" edited sortable header="收取方式" name="bae551" codetype="BAZ551"></ep-table-column>
                        <ep-table-column editor="select" edited sortable header="材料状态" name="bae553"  codetype="BAE553"></ep-table-column>
                    </ep-table>
                    <el-row :gutter="10">
                        <ep-select colspan="8" label="短信发送" name="bae515"  :property="form.bae515"
                                   p="R"   :datas="{formData: form}" border ></ep-select>
                        <ep-input colspan="16" label="短信内容" name="bae547" :property="form.bae547"
                                  p="R"  :datas="{formData: form}" ></ep-input>


                    </el-row>
                    <el-row type="flex" justify="center" >
                        <ep-saveButton id="" top="20" type="primary" bottom="20"
                                       :datas="{formData: form}" name="保存"></ep-saveButton>
                        <ep-Button id="" top="20" type="primary" bottom="20"
                                   name="清空"></ep-Button>
                    </el-row>
                </el-form>

            </el-card>
        </el-main>

    </el-main>

</template>

<script type="es6">
    export default {
        data() {
            return {
                form:{
                    aac001: {
                        value: '',
                        p: 'H'
                    },
                    bae506: {
                        value: '',
                        p: 'H'
                    },
                    blc545: {
                        value: '',
                        p: 'H'
                    },
                    blc544: {
                        value: '',
                        p: 'H'
                    },
                    bae507: {
                        value: '',
                        p: 'H'
                    },
                    blc500: {
                        value: '',
                        p: 'H'
                    },
                    blc501: {
                        key: '',
                        value: '',
                        p: 'H'
                    },
                    bae515: {
                        key: '',
                        value: '',
                        p: 'R'
                    },
                    bae547: {
                        value: '',
                        p: 'R'
                    },

                },
                tableData: [],

                rules:{
                    bae515: [
                        {required: true, message: '必填项，不能为空'}
                    ],
                    bae547: [
                        {required: true, message: '必填项，不能为空'}
                    ],

                },
                codeTypes:{
                    BLC501:[],
                    BAE547:[],
                    BAZ551:[],
                    BAE553:[],

                },
                pager: {
                    page: 1,
                    size: 10
                },
                total: 0,
            }
        },
        computed: {
            backFun() {
                return this.$store.getters.backFun;
            },
            init_formData() {
                if (this.$store.getters.init.path !== this.$route.path)  return;
                return this.$store.getters.init.form;
            },
            doInitformData: {
                get: function () {
                    if (this.$store.getters.common === null) return [];
                    if (this.$store.getters.common.path !== this.$route.path) return;
                    return this.$store.getters.common.formData;
                },
                set: function (newValue) {
                    if (newValue.path !== this.$route.path) return;
                    return newValue;
                }
            },

        },
        created() {
            let param = {
                path: this.$route.path,
                codeTypes:this.codeTypes,
                form:this.form,
                tableData:this.tableData

            };
            this.$store.dispatch('SET_INIT', param);
        },
        watch: {
            init_formData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },
            doInitformData: {
                handler(value) {
                    if (value == undefined) return;
                    this.getformData(value);
                },
                deep: true
            },

            backFun: {
                handler(value) {
                    if (value === null) return;
                    this.customBackFun();
                    let backFun = [];
                    backFun = value.split(',');
                    if (backFun.indexOf('rDoInit') >= 0) {
                        let codeTypes = {
                            BLC501:[],
                            BAE547:[],
                            BAZ551:[],
                            BAE553:[],

                        };
                        let form = {
                            aac001: {
                                value: '',
                                p: 'H'
                            },
                            bae506: {
                                value: '',
                                p: 'H'
                            },
                            blc545: {
                                value: '',
                                p: 'H'
                            },
                            blc544: {
                                value: '',
                                p: 'H'
                            },
                            bae507: {
                                value: '',
                                p: 'H'
                            },
                            blc500: {
                                value: '',
                                p: 'H'
                            },
                            blc501: {
                                key: '',
                                value: '',
                                p: 'H'
                            },
                            bae515: {
                                key: '',
                                value: '',
                                p: 'R'
                            },
                            bae547: {
                                value: '',
                                p: 'R'
                            },

                        };
                        let tableData= [];

                        let param = {
                            path: this.$route.path,
                            codeTypes:codeTypes,
                            form:form,
                            tableData:tableData

                        };
                        this.$store.dispatch('SET_INIT', param);
                    }
                }
            }
        },
        methods: {
            getformData(value) {
                this.form = value;
            },

            handleSizeChange(val) {
                console.log(`每页 ${val} 条`);
            },
            handleCurrentChange(val) {
                console.log(`当前页: ${val}`);
            },
            handleEdit(id) {
                this.dialogFormVisible = true;
            },
            customBackFun(){//自定义方法体
            },
        },
    }
</script>
